<!--课时量审核-填报课时量-->
<template>
  <div class="assessment-container">
    <div class="search-container" style="padding-left:0">
      <div class="search-container-left">
        <div class="search-container-item">
          <span>学期：</span>
          <el-select
            v-model="termid"
            style="width: 90px"
            size="mini"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="item in xueqiList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item">
          <span >开课教研室：</span>
          <el-select
            v-model="kkjys"
            style="width: 138px"
            size="mini"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="item in kkjysList"
              :key="item.value"
              :label="item.value"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item">
          <span>授课教员:</span>
          <el-input
            style="width: 152px"
            size="mini"
            placeholder="请输入内容"
            v-model="skjy"
          ></el-input>
        </div>
        <div class="search-container-item">
          <span>课程名称：</span>
          <el-input
            style="width: 152px"
            size="mini"
            placeholder="请输入内容"
            v-model="coursename"
          ></el-input>
        </div>
        <div class="search-container-item">
          <span>状态:</span>
          <el-select
            v-model="traininglevel"
            style="width: 108px"
            size="mini"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="item in pyccList"
              :key="item.value"
              :label="item"
              :value="item"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item">
          <span>备注:</span>
          <el-select
            v-model="studytype"
            style="width: 88px"
            size="mini"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="item in xxlxList"
              :key="item.value"
              :label="item"
              :value="item"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-button" @click="updatPostList">
          <img src="../../../assets/assessment/icon-search.png" alt="" />
          <span>查询</span>
        </div>
        <div class="search-buttona" @click="upadteAs">
          <img src="../../../assets/assessment/icon-search.png" alt="" />
          <span>批量审核</span>
        </div>
      </div>

    </div>
    <div class="plan-entry-table-container">
        <admintablelist v-on:arr = "updateArr($event)" :dataList="dataList" v-show="dataList" :isOperation="true" :url="url" :colDataList="colDataList" :config="config">
        </admintablelist>
     </div>
    <div class="bottom-block">
      <div class="text">授课教员名字后加“*”为课程负责人</div>
    </div>
  </div>
</template>

<script>
import admintablelist from "@/views/comonents/admintablelist";
import {postList,abspostList,getdepartmentOf,getcheckStatus,gethasCommonts,reqGetXqList } from "../../../api/classHoursAddList/addList";
import {queryCommonXueqi, queryDefaultXueQi} from "@/api/trainingManagement/place.js"
export default {
  components: {
    admintablelist
  },
  data() {
    return {
      arr:[],
      termid: "",
      skjy:"",
      coursename:"",
      xueqiList: [
        {
          value: "2021秋",
          label: "2021秋",
        },
        {
          value: "2020夏",
          label: "2020夏",
        },
      ],
      kkjys: "",
      kkjysList: [
        {
          value: "教研室一",
          label: "教研室一",
        },
        {
          value: "教研室二",
          label: "教研室二",
        },
      ],
      traininglevel: "",
      pyccList: [
        {
          value: "高级数学系",
          label: "高级数学系",
        },
        {
          value: "高级英文系",
          label: "高级英文系",
        },
      ],
      studytype: "",
      xxlxList: [
        {
          value: "有",
          label: "有",
        },
        {
          value: "无",
          label: "无",
        },
      ],
      url:'/admin/ManagementHours/classAddHours',
      colDataList: [{
        label: '状态',
        prop: 'checkStatus',
        align: 'center',
        width: '80'
      }, {
        label: '课程名称',
        prop: 'courseName',
        align: 'center',
        width: '150'
      }, {
        label: '教学班',
        prop: 'className',
        align: 'center',
        width: '140'
      }, {
        label: '课程性质',
        prop: 'teachNature',
        align: 'center',
        width: '120'
      }, {
        label: '教学对象',
        prop: 'teachObject',
        align: 'center',
        width: '160'
      }, {
        label: '实际上课人数',
        prop: 'studentNumber',
        align: 'center',
        width: '150'
      }, {
        label: '授课教员',
        prop: 'teacherName',
        align: 'center',
        width: '120'
      }, {
        label: '教研室',
        prop: 'department',
        align: 'center',
        width: '120'
      }, {
        label: '职称',
        prop: 'rank',
        align: 'center',
        width: '100'
      }, {
        label: '高/中/初职',
        prop: 'jobGrade',
        align: 'center',
        width: '120'
      }, {
        label: '承担任务',
        prop: 'task',
        align: 'center',
        width: '120'
      }, {
        label: '实装/实弹',
        prop: 'actual',
        align: 'center',
        width: '130'
      }, {
        label: '装备名称/型号',
        prop: 'equipment',
        align: 'center',
        width: '160'
      }, {
        label: '实际理论讲授课时',
        prop: 'jshour',
        align: 'center',
        width: '150'
      }, {
        label: '实际实践讲授课时',
        prop: 'sjhour',
        align: 'center',
        width: '150'
      }, {
        label: '实际合计课时',
        prop: 'conuthour',
        align: 'center',
        width: '150'
      }, {
        label: '实际折算系数',
        prop: 'acc',
        align: 'center',
        width: '150'
      }, {
        label: '课时量',
        prop: 'workload',
        align: 'center',
        width: '120'
      }, {
        label: '课时标准',
        prop: 'classStandard',
        align: 'center',
        width: '120'
      }, {
        label: '备注',
        prop: 'commonts',
        align: 'center',
        width: '120'
      }],
      config: {
        mergeTarget: 'courseId', // 通用依据
        combineProp: [
          'select',
          'de',
          'cz',
          'checkStatus',
           'courseName',
            'className',
            'teachNature',
           'teachObject',
           'studentNumber'
        ]
      },
      dataList: [{
        checkStatus:"待审核",
        courseName:"课程名称123",
        className:"教学一班",
        teachNature:"必修",
        teachObject:"李四",
        studentNumber:"14",
        teacherName:"李教员",
        department:"教研室一",
        clall:"教员",
        senjun:"中职",
        task:"课程实讲",
        actual:"",
        equipment:"",
        jshour:"",
        sjhour:"",
        actualClass:"",
        actualCoefficient:"",
        amountTime:"",
        standardClass:"",
        commonts:"",
        },{
        checkStatus:"待审核",
        courseName:"课程名称123",
        className:"教学一班",
        teachNature:"必修",
        teachObject:"李四",
        studentNumber:"14",
        teacherName:"张教员",
        department:"教研室二",
        clall:"教师",
        senjun:"高职",
        task:"课程实讲",
        actual:"",
        equipment:"",
        jshour:"",
        sjhour:"",
        actualClass:"",
        actualCoefficient:"",
        amountTime:"",
        standardClass:"",
        commonts:"",
        },
        {
        checkStatus:"以审核",
        courseName:"课程名称3",
        className:"教学二班",
        teachNature:"必修二",
        teachObject:"王五",
        studentNumber:"18",
        teacherName:"张教员",
        department:"教研室二",
        clall:"教师",
        senjun:"高职",
        task:"课程实讲",
        actual:"",
        equipment:"",
        jshour:"",
        sjhour:"",
        actualClass:"",
        actualCoefficient:"",
        amountTime:"",
        standardClass:"",
        commonts:"",
        },

      ],

    }
  },
    methods: {
       // 获取学期院历列表
    async getXqList() {
      const result = await queryCommonXueqi();
      if (result.data.code == 200) {
        this.xueqiList = result.data.data;
      }
    },
      async getDefaultXueQi(){
        queryDefaultXueQi().then(res=>{
          if(res.data.code == 200){
            this.termid = res.data.data
          }
        }).then(()=>{
          this.postList()
        })
      },
      getdepartmentOf: function () {
        return new Promise(() => {
          getdepartmentOf().then(res => {
            this.kkjysList = res.data.data;
             console.log("s")
              console.log(res.data.data,"009090")
              console.log(this.kkjysList)
              console.log("f")
          })
        })

    },
    getcheckStatus: function () {
        return new Promise(() => {
          getcheckStatus().then(res => {
            this.pyccList = res.data.data
             console.log("d")
              console.log(res.data.data)
               console.log(this.pyccList)
              console.log("e")
          })
        })

    },
    gethasCommonts: function () {
        return new Promise(() => {
          gethasCommonts().then(res => {
            this.xxlxList = res.data.data
             console.log("d")
              console.log(res.data.data)
               console.log(this.xxlxList)
              console.log("e")
          })
        })

    },


      updateArr(arr){
        this.arr=arr

      },
     upadteAs(){
       if(this.arr.toString()!=""){
        let obj={
          ids:this.arr.toString(),
          operation:"pass"
        }

       console.log(obj)
       return new Promise(() => {
        abspostList(obj).then(res => {
         this.postList();
        })
      })
      }{
        this.$message.error("请选择要审核的数据")
      }
     },
    handleSelectionChange(val) {

      console.log("ssss"),
      console.log(val)
    },
    updatPostList: function () {
      let el=this
      let obj={
        semester:this.termid,
        hasCommonts:this.studytype,
        checkStatus:this.traininglevel,
        departmentOf:this.kkjys,
        courseName:this.skjy,
        teacherName:this.coursename
      }
      return new Promise(() => {
        postList(obj).then(res => {
          el.dataList = res.data.data

        })
      })
    },
    postList: function () {
      let el=this
      let obj={
        semester:this.xq
      }
      return new Promise(() => {
        postList(obj).then(res => {
          el.dataList = res.data.data
          console.log("aa")
          console.log(res.data.data)
          console.log("bb")
        })
      })
    },
  },
  mounted() {
    this.getDefaultXueQi()
    this.getXqList()
    // this.postList();
    this.gethasCommonts();
    this.getcheckStatus();
    this.getdepartmentOf();

  },
};
</script>
<style lang="less" scoped>
.plan-entry-table-container {
  margin-top: 30px;
  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }
  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 82px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }
  .el-table th.el-table__cell > .cell {
    padding: 0;
  }
  .el-table .cell,
  .el-table--border .el-table__cell:first-child .cell {
    padding: 0;
  }
  .el-table__body td .cell {
    padding: 0;
  }

  .add-button {
    margin: 0 auto;
    cursor: pointer;
    background: #fff6ef;
    border: 1px solid #f3b815;
    width: 65px;
    height: 28px;
    line-height: 28px;
    border-radius: 6px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    > span {
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3b815;
    }
    > img {
      width: 13px;
      height: 13px;
      margin-right: 8px;
    }
  }
  .pass-text {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #51aef6;
  }
  .wait-text {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #ff3819;
  }
  .watch-button {
    width: 76px;
    height: 36px;
    background: #fef1e8;
    border: 1px solid #f86900;
    border-radius: 6px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #f86900;
    line-height: 16px;
    margin: 2px auto;
  }
}
</style>

<style lang="less" scoped>
.assessment-container {
  /*width: 1875px;*/
  /*margin: 0 auto;*/
  .search-container {
    margin-top: 27px;
    padding-left: 43px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    .search-container-left,
    .search-container-right {
      display: flex;
      flex-direction: row;
    }
    .search-container-item {
      color: #004ca7;
      font-size: 16px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      margin-right: 30px;
      > span {
        margin-right: 6px;
      }
    }
    .search-button {
      width: 77px;
      height: 28px;
      line-height: 28px;
      background: #f1f8fe;
      border: 1px solid #51aef6;
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      > span {
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #51aef6;
      }
      > img {
        width: 20px;
        height: 20px;
        margin-right: 4px;
      }
    }
    .search-buttona {
      width: 107px;
      height: 28px;
      line-height: 28px;
      background: #f1f8fe;
      border: 1px solid #51aef6;
      border-radius: 6px;
      margin-left: 10px;
      cursor: pointer;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      > span {
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #51aef6;
      }
      > img {
        width: 20px;
        height: 20px;
        margin-right: 4px;
      }
    }
  }
  .bottom-block {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    .text {
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      line-height: 39px;
      color: #004ca7;
    }
  }
  .plan-entry-table-container {
    margin-top: 30px;
    .table-data {
      width: 100%;
      border: 0.8px solid #004ca7;
      border-radius: 9px;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #004ca7;
    }
  }
}
</style>
